<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<title>滴滴法律</title>
	<link rel="stylesheet" type="text/css" href="css/normalize.css">
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="css/my-style.css">
	<!--[if lt IE 9]> 
		<script src="js/html5shiv.min.js"></script> 
	<![endif]-->
</head>
<body>
	<!-- 导航栏 -->
	<header>
		<nav class="navbar navbar-inverse">
			<div class="container">
				<div class="navbar-header">
					<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse-1" aria-expanded="false">
		        <span class="sr-only">Toggle navigation</span>
		        <span class="icon-bar"></span>
		        <span class="icon-bar"></span>
		        <span class="icon-bar"></span>
		      </button>
		      <a class="navbar-brand" href="index.html">
		        <img alt="LOGO" src="img/50x30.png">
		      </a>
				</div>
				<div class="collapse navbar-collapse" id="navbar-collapse-1">
					<ul class="nav navbar-nav navbar-left">
						<li class="cur"><a href="index/home">首页</a></li>
	          <li><a href="lawyer/list">法律人</a></li>
	          <li><a href="contract/list">法律产品</a></li>
	          <li><a href="knowledge/index">法律知识</a></li>
	          <li><a href="#">招聘</a></li>
					</ul>

					<ul class="nav navbar-nav navbar-right">						
	          			<li><a href="">律师，您好！<span class="caret"></span></a></li>
					</ul>
				</div>
			</div>
		</nav>
	</header>
	
	<section>
		<div class="container">
			<div class="row">
				<div class="col-md-3 col-sm-3 col-xs-12">
					<div class="sidebar-box sidebar-per-list show-per-list">
						<ul class="per-list-ul" id="per-list-ul">
							<li class="list-cur"><a href="javascript:;">我的回答</a></li>
							<li><a href="javascript:;">查看帮助</a></li>
						</ul>
					</div>
					<br/>
					<div class="col-md-12 text-center hidden-xs clear-padding">
						<img src="img/260x200.png" alt="">
					</div>
				</div>


				<div class="col-md-9 col-sm-9 col-xs-12">

				<!-- 我的回答内容开始 -->
					<div class="sidebar-box sidebar-per-list show-per-list clearfix" id="sidebar-per-list1">
						<div class="per-buy-ul" id="per-req-ul">
							<ul>
								<li class="list-buy-cur"><a href="javascript:;">待回答</a></li>
								<li><a href="javascript:;">已回答</a></li>
							</ul>
						</div>
						<!-- 待回答内容 -->
						<div class="per-req-con per-buy-con-cur clearfix" id="per-req-con1">
							<c:forEach items="${questions}" var="questions">
							<div class="dotted">
								<h4><strong>${questions.questitle}</strong></h4>
								<div class="col-md-12">
									<p class="text-muted">${questions.quescontent}</p>
								</div>
								<div style="margin-bottom:15px;">
									<a class="req-toggle" href="javascript:;"><strong><span>我</span></strong></a><input type="button" class="btn btn-default btn-xs btn-position" value="立即回答" data-toggle="collapse" data-target="#my-req${questions.questionid}" aria-expanded="false" aria-controls="my-req1">
								</div>
								<div class="collapse" id="my-req${questions.questionid}">
								  <div class="well">
								    <form method="post"  id="answer${questions.questionid}">
									  	<div class="form-group comment-textarea">		    
										    <textarea class="form-control" placeholder="文明上网,参与评论" maxlength="100" rows="4" name="replycontent" id="replycontent${questions.questionid}"></textarea>
												<input type="button" class="btn btn-info" value="解答问题"  onclick="answerQues((${questions.questionid}))">
												<input type="hidden" value="${questions.questionid}" name="quesid" id="quesid${questions.questionid}">
									    </div>
									    
									  </form>  
								  </div>
								</div>
							</div>
							</c:forEach>





						</div>





						<!-- 已回答内容 -->
						<div class="per-req-con clearfix" id="per-req-con2">
						
						</div>

					</div><!-- 我的回答内容结束 -->



					<!-- 我的购买内容开始 -->
					<div class="sidebar-box sidebar-per-list clearfix" id="sidebar-per-list2">
						<ul class="per-buy-ul" id="per-buy-ul">
							<li class="list-buy-cur"><a href="javascript:;">待付款</a></li>
							<li><a href="javascript:;">处理中</a></li>
							<li><a href="javascript:;">已完成</a></li>
						</ul>

						<!-- 待付款内容 -->
						<div class="per-buy-con per-buy-con-cur clearfix" id="per-buy-con1">
							<div class="col-md-12">
								<div class="col-md-4">
									<h4>风险控--写合同</h4>
								</div>
								<div class="col-md-4">
									<p>2015年11月3日</p>
								</div>
								<div class="col-md-4 text-right">
									<input type="button" class="btn btn-warning" value="删除">
									<input type="button" class="btn btn-success" value="付款">
								</div>						
							</div>
						</div>
						<!-- 处理中内容 -->
						<div class="per-buy-con clearfix" id="per-buy-con2">

							<div class="col-md-12">
								<div class="col-md-4">
									<h4>风险控--写合同</h4>
								</div>
								<div class="col-md-4">
									<p>2015年11月3日</p>
								</div>
								<div class="col-md-4 text-right">
									<input type="button" class="btn btn-default" value="处理中" disabled>
								</div>						
							</div>

							<div class="col-md-12">
								<div class="col-md-4">
									<h4>风险控--写合同</h4>
								</div>
								<div class="col-md-4">
									<p>2015年11月3日</p>
								</div>
								<div class="col-md-4 text-right">
									<input type="button" class="btn btn-default" value="处理中" disabled>
								</div>						
							</div>


						</div>
						<!-- 已完成内容 -->
						<div class="per-buy-con clearfix" id="per-buy-con3">
							<div class="col-md-12">
								<div class="col-md-4">
									<h4>风险控--写合同</h4>
								</div>
								<div class="col-md-4">
									<p>2015年11月3日</p>
								</div>
								<div class="col-md-4 text-right">
									<input type="button" class="btn btn-success" value="完成">
								</div>						
							</div>
						</div>

					</div><!-- 我的购买内容结束 -->


					<!-- 查看帮助内容开始 -->
					<div class="sidebar-box sidebar-per-list clearfix" id="sidebar-per-list3">
						<p>查看帮助</p>

					</div><!-- 查看帮助内容结束 -->



					<!-- 账号设置内容开始 -->
					<!-- 账号设置内容开始 -->
					<div class="sidebar-box sidebar-per-list clearfix" id="sidebar-per-list4">
						<form class="form-horizontal" action="" method="post">
							<div class="form-group">
						    <label class="col-sm-2 control-label">账号</label>
						    <div class="col-sm-4">
						      <p class="form-control-static">13821555643</p>
						      <a href="javascript:;" class="form-control-static text-red" data-toggle="modal" data-target="#changepsd">修改密码</a>
						    </div>
						  </div>
							<div class="form-group">
								<label for="petname" class="col-sm-2 control-label">昵称</label>
								<div class="col-sm-4">
									<input id="petname" class="form-control" placeholder="请输入原密码" name="">
								</div>
							</div>
							<div class="form-group">
								<label class="col-md-2 control-label">性别</label>
								<div class="col-md-4">	
								  <label class="radio-inline" style="margin-right:30px;">
								    <input type="radio" name="sex" id="man" value="1" checked>男							    
								  </label>
								  <label class="radio-inline">
								    <input type="radio" name="sex" id="woman" value="2">女							    
								  </label>	
								</div>
							</div>
							<div class="form-group">
								<label class="col-md-2 control-label">地区</label>
								<div class="col-sm-2">
									 <select class="form-control" name="">
									  <option>天津</option>
									  <option>北京</option>
									  <option>河北省</option>
									</select>
								</div>
								<div class="col-sm-2">
									 <select class="form-control" name="">
									  <option>和平区</option>
									  <option>河北区</option>
									  <option>河西区</option>
									</select>
								</div>
						 </div>
						 <div class="form-group">
					     <label for="email" class="col-sm-2 control-label">邮箱</label>
					     <div class="col-sm-4">
					       <input type="text" class="form-control" id="email" placeholder="请填写邮箱" value="664339636@qq.com" name="">
					     </div>
					   </div>
					   <div class="form-group">
						    <div class="col-sm-offset-2 col-sm-10">
						      <button type="submit" class="btn btn-black">保存</button>
						    </div>
						  </div>
						</form>
					
					</div><!-- 账号设置内容结束 -->



				</div>
			</div>
		</div>
	</section>
	<!-- 修改密码弹出框 -->
	<div id="changepsd" class="modal fade" role="dialog" aria-labelledby="gridSystemModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="gridSystemModalLabel">修改密码</h4>
      </div>
      <form class="form-horizontal" action="" method="post">
      <div class="modal-body">
        <div class="container-fluid">
          <div class="row">
            
							<div class="form-group">
								<label for="oldpsd" class="col-sm-3 control-label">原密码</label>
								<div class="col-sm-6">
									<input id="oldpsd" class="form-control" placeholder="请输入原密码" name="">
								</div>
							</div>
							<div class="form-group">
								<label for="newpsd" class="col-sm-3 control-label">新密码</label>
								<div class="col-sm-6">
									<input id="newpsd" class="form-control" placeholder="请输入新密码" name="">
								</div>
							</div>
							<div class="form-group">
								<label for="repeatpsd" class="col-sm-3 control-label">确认密码</label>
								<div class="col-sm-6">
									<input id="repeatpsd" class="form-control" placeholder="请重新输入新密码" name="">
								</div>
							</div>
						
          </div>
          
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        <button type="button" class="btn btn-primary">修改</button>
      </div>
      </form>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div>

	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript">
	var rct_rul = /^[\u4e00-\u9fa5]{2,30}$/;
			function answerQues(quesId){
				   var replycontent = $("#replycontent"+quesId).val();
				   var quesid = $("#quesid"+quesId).val();
				   var flag = true;
				   if(replycontent == ""){
						alert("请输入问题解决方案!");
						flag = false;
					}else if(!rct_rul.test(replycontent)){
						alert("请输入合法的问题解决方案!");
						flag = false;
					}else if(quesid == ""){
						alert("系统繁忙!请稍后再试!");
						flag = false;
					}
				   if(flag){
				   			var url = "lawyer/answer";
							var args = $("#answer"+quesId).serialize();
							$.post(url, args, function(data) {
								alert(data.MSG);
								location.reload();
						});
				 	};
			};
		$(function(){
			//我的咨询,我的购买,查看帮助,账号设置标签切换
			$('#per-list-ul li').each(function(index1){
				var $sidebarPerList = $('#sidebar-per-list1, #sidebar-per-list2, #sidebar-per-list3, #sidebar-per-list4');
				$(this).click(function(){
					var _this = $(this);
					$('#per-list-ul li').removeClass('list-cur');
					_this.addClass('list-cur');
					$sidebarPerList.removeClass('show-per-list');
					$sidebarPerList.eq(index1).addClass('show-per-list');

					if(index1 == 1){
						//我的购买切换
						$('#per-buy-ul li').each(function(index2){
							$(this).click(function(){
								var __this = $(this);
								var $buyCon = $('#per-buy-con1, #per-buy-con2, #per-buy-con3');
								$('#per-buy-ul li').removeClass('list-buy-cur');
								$buyCon.removeClass('per-buy-con-cur');
								__this.addClass('list-buy-cur');
								$buyCon.eq(index2).addClass('per-buy-con-cur');
							});
						});
						//我的购买切换结束
					};
				});
			})
			
			$('#per-req-ul li').each(function(index){
				$(this).click(function(){
					var __this = $(this);
					var $reqCon = $('#per-req-con1, #per-req-con2');
					$('#per-req-ul li').removeClass('list-buy-cur');
					$reqCon.removeClass('per-buy-con-cur');
					__this.addClass('list-buy-cur');
					$reqCon.eq(index).addClass('per-buy-con-cur');
					if(index == 0){
						location.href = "lawyer/person";
					}
					if(index == 1){
							var url = "lawyer/answer";
							var args = {"time":new Date()};
							$.getJSON(url, args, function(data) {
									$("#per-req-con2").empty();
									for(var i=0;i<data.answered.length;i++){
				   					var ques_title = data.answered[i].quesTitle;
				   					var ques_content = data.answered[i].quesContent;
				   					var aer_content = data.answered[i].replycontent;
				  					$("#per-req-con2").append("<div class='dotted clearfix' id='answer-ques'>"
																				+"<h4><strong>"+ques_title+"</strong></h4>"
																				+"<div class='col-md-12'>"
																					+"<p class='text-muted'>"+ques_content+"</p>"
																				+"</div>"
																				+"<div style='margin-bottom:10px;'>"
																					+"<a class='req-toggle' href='javascript:;''><strong>我的回答</strong></a>"
																					
																				+"</div>"
																				+"<div class='col-md-12'>"
																					+"<p class='text-muted'>"+aer_content+"</p>"
																				+"</div>"
																			+"</div>")	;
				   			};
						});
					};
				});
			});
			
			//我的回答

		$('#per-req-ul li').each(function(index){
			$(this).click(function(){
				var __this = $(this);
				var $reqCon = $('#per-req-con1, #per-req-con2');
				$('#per-req-ul li').removeClass('list-buy-cur');
				$reqCon.removeClass('per-buy-con-cur');
				__this.addClass('list-buy-cur');
				$reqCon.eq(index).addClass('per-buy-con-cur');
			});
		});
		});
	</script>
</body>
</html>